package com.qfedu.yanglao20app.handicapped.attention.controller;

import com.qfedu.yanglao20.common.CommonResult;
import com.qfedu.yanglao20.common.annotation.LogInfo;
import com.qfedu.yanglao20.entity.handicapped.HandicappedAttention;
import com.qfedu.yanglao20app.handicapped.attention.service.AppHandicappedAttentionService;
import com.qfedu.yanglao20app.handicapped.attention.vo.AttentionVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author yujie
 * @data 2023/5/19 22:50
 */
@Api(tags = "服务管理页面")
@RestController
@RequestMapping("/app/attention")
public class AppHandicappedAttentionController {

    @Resource
    private AppHandicappedAttentionService appHandicappedAttentionService;

    @LogInfo
    @ApiOperation(value = "展示服务管理关注信息", notes = "展示服务管理关注信息")
    @GetMapping("/List")
    public CommonResult<AttentionVO> attentionList(Integer handicappedId) {
        List<AttentionVO> strings = appHandicappedAttentionService.attentionList(handicappedId);
        return CommonResult.success(strings);
    }

    @LogInfo
    @ApiOperation(value = "修改关注或取消关注", notes = "修改关注或取消关注")
    @PostMapping("/update")
    public CommonResult<HandicappedAttention> updateAttention(HandicappedAttention handicappedAttention) {
        appHandicappedAttentionService.insertAttention(handicappedAttention);
        return CommonResult.success();
    }
}
